"use strict";
$(function () {    
    vm.getArchitectureTreeList();
    vm.getDepartTypeList();
});

var setting = {
    data: {
        simpleData: {
            enable: true,
            idKey: "id",
            pIdKey: "parentId",
            rootPId: -1
        },
        key: {
        	name: "treename",
            url: "nourl"
        }
    },
    callback: {
		onClick: architectureTreeOnClick
	},
	view: {
		expandSpeed: "fast"
	}
};
var changeTreeSetting={
	data: {
        simpleData: {
            enable: true,
            idKey: "id",
            pIdKey: "parentId",
            rootPId: -1
        },
        key: {
        	name: "treename",
            url: "nourl"
        }
    },
	view: {
		expandSpeed: "fast"
	}	
};
function architectureTreeOnClick(event, treeId, treeNode) {
	vm.parentDepartment=treeNode;
	$("#departmentInfoGrid").jqGrid('setGridParam',{page:1});
	$("#employeeInfoGrid").jqGrid('setGridParam',{page:1});
	$("#companyBranchGrid").jqGrid('setGridParam',{page:1});
	if(vm.showDepartmentList){
		vm.reloadDepartmentInfo();
	}
	if(vm.showEmployeeList){
		vm.reloadEmployeeInfo();
	}
	if(vm.showBranchList){
		vm.reloadBranch();
	}
};
var validatePhone=function(rule, value, callback){
	var myPhoneReg=/^[1][3,4,5,6,7,8,9][0-9]{9}$/;
	if (!myPhoneReg.test(value)) {
		callback(new Error('手机号格式不正确'));
    } else {
    	var vPhoneUrl="../org/employeeInfo/queryAllPerson?phone="+value;
    	if(vm.employeeInfo.id){
    		vPhoneUrl+="&eId="+vm.employeeInfo.id;
    	}
    	Ajax.request({
			url: vPhoneUrl,
			type: "POST",
			contentType: "application/json",
			successCallback: function (r) {
				if(r.code==0){
					if(r.list.length>0){
						var personInfo=r.list[0];
						if(vm.employeeInfo.name&&vm.employeeInfo.phone
								&&vm.employeeInfo.name==personInfo.name
								&&vm.employeeInfo.phone==personInfo.phone){
							var result=true;
							for (var i = 0; i < r.list.length; i++) {
								if(vm.employeeInfo.companyId==r.list[i].company_id){
									result=false;break;
								}
							}
							if(result){
								vm.employeeInfo.personId=personInfo.id;
								callback();return;
							}else{
								vm.showPhoneCode=true;
								callback(new Error('手机号已经被使用'));return;
							}
						}
						vm.showPhoneCode=true;
						callback(new Error('手机号已经被使用'));
					}else{
						callback();
					}
				}else{
					callback();
				}
			}
		});
    }
};

var vm = new Vue({
	el: '#companyArchitecture',
	data: {
		companyInfo:{},
		parentDepartment:{},
		uploadInfo: {},
		baseImgUrl: "",
		showDepartmentList:true,
		showPhoneCode:false,
		showEmployeeList:true,
		showBranchList:true,
        showAllEmployee: true,
        tabname: "department",
        tabFirst: "门店",
        tabSecond: "部门",
        tabThird: "员工",
        title: null,
        isAdmin:false,
        isCompany:false,
        uploadLicenseList:[],
        uploadIdcardPositiveList:[],
        uploadIdcardReverseList:[],
		orgCompanyBranch: {},
        orgDepartment:{},
        employeeInfo:{},
        employeeData:{},
        roleList:[],
        departTypeList:[],
        treeDataList:[],
		ruleDepartmentInfoValidate: {
			name: [
				{required: true, message: '名称不能为空', trigger: 'blur'}
			]
		},
		ruleEmployeeValidate: {
			name: [
		       {required: true, message: '名称不能为空', trigger: 'blur'}
		    ],
			phone: [
		       {required: true, message: '手机号不能为空', trigger: 'blur'},
		       {validator: validatePhone, trigger: 'change'}
		    ]
		},
		ruleBranchValidate: {
			name: [
				{required: true, message: '名称不能为空', trigger: 'blur'}
			]
		},
		departmentQuery: {
		    name: ''
		},
		employeeQuery: {
			name: '',phone:'',position:''
		},
		branchQuery: {
		    name: '',phone:'',attn:''
		}
	},
	methods: {
		sendPhoneCode:function(){
			Ajax.request({
                url: '../sys/common/phonecode?phone='+vm.employeeInfo.phone,
                async: true,
                successCallback: function (r) {
                    alert("手机验证码已发送！");
                }
            });
//			alert(vm.employeeInfo.phone);
		},
		getDepartTypeList:function(){
			Ajax.request({
                url: '../org/depart/type',
                async: true,
                successCallback: function (r) {
                    vm.departTypeList = r.list;
                }
            });
		},
		getUploadFileToken:function(){
			Ajax.request({
                url: "../sysUpload/getToken",
                async: true,
                successCallback: function (r) {
                    vm.uploadInfo.token=r.uptoken;
                    vm.uploadInfo.key="msgModel"+(new Date().getTime());
                    vm.baseImgUrl=r.baseImgUrl;
                }
            });
		},
		selectParent:function(dataType){
			$.fn.zTree.init($("#architectureChangeTree"), changeTreeSetting, vm.treeDataList).expandAll(true);
			openWindow({
                title: "选择上级",
                area: ['300px', '450px'],
                content: jQuery("#orgCompanyArchitectureLayer"),
                btn: ['确定', '取消'],
                btn1: function (index) {
                    var node =  $.fn.zTree.getZTreeObj("architectureChangeTree").getSelectedNodes();
                    vm.parentDepartment=node[0];
                    layer.close(index);
                }
            });
		},
		selectCompanyPosition:function(){
			openWindow({
            	type: 2,
                title: "选择职位",
                area: ['55%', '80%'],
                content: ['../org/positiondict.html?companyId='+vm.companyInfo.id+"&positionId="+vm.employeeInfo.positionId+"&positionName="+vm.employeeInfo.positionName],
                btn: ['确定', '取消'],
                btn1: function (index,layero) {
                	var selectRowData = window[layero.find('iframe')[0]['name']].getSelectedRowData('#positionDictGrid');
                	if(selectRowData.length){
                		iview.Message.error("请选择一条数据！");
                		return;
                	}
                	vm.employeeInfo.position=selectRowData.code;
                	vm.employeeInfo.positionContent=selectRowData.codeName;
                	vm.employeeInfo.positionId=selectRowData.id;
                	vm.employeeInfo.positionName=selectRowData.name;
                    layer.close(index);
                }
            });
		},
		selectCompanyPositionPart:function(){
			openWindow({
				type: 2,
				title: "选择职位",
				area: ['55%', '80%'],
				content: ['../org/positiondict.html?companyId='+vm.companyInfo.id],
				btn: ['确定', '取消'],
				btn1: function (index,layero) {
					var selectRowData = window[layero.find('iframe')[0]['name']].getSelectedRowData('#positionDictGrid');
					if(selectRowData.length){
						iview.Message.error("请选择一条数据！");
						return;
					}
					var positionPart={"code":selectRowData.code,"codeName":selectRowData.codeName,"positionId":selectRowData.id,"positionName":selectRowData.name};
					vm.employeeInfo.positionPartList.push(positionPart);
					layer.close(index);
				}
			});
		},
		handlePositionPartRemove:function(event,name){
			var positionId=name;
			var positionPartList=vm.employeeInfo.positionPartList;
			if(positionPartList&&positionPartList.length>0){
				for (var i = 0; i < positionPartList.length; i++) {
    				if(positionId==positionPartList[i].positionId){
    					positionPartList.splice(i,1);break;
    				}
				}
				vm.employeeInfo.positionPartList=brandSelectedList;
			}
		},
		changeCompany:function(){
			openWindow({
            	type: 2,
                title: "选择公司",
                area: ['80%', '60%'],
                content: ['../org/companyinfoSelect.html?status=1'],
                btn: ['确定', '取消'],
                btn1: function (index,layero) {
                	var selectRowData = window[layero.find('iframe')[0]['name']].getSelectedRowData('#companyInfoGrid');
                	vm.getArchitectureTreeList(selectRowData.id);
                    layer.close(index);
                }
            });
		},
		getRole:function(){
			Ajax.request({
                url: '../sys/role/select?companyId='+vm.companyInfo.id,
                async: true,
                successCallback: function (r) {
                    vm.roleList = r.list;
                }
            });
		},
		activeTab:function(val){
			vm.tabname=val;
		},
		getArchitectureTreeList:function(val){
			var url="../org/architecture/queryAll";
			if(val){
				url+="?parentList="+val;
			}
			
			Ajax.request({
                url: url,
                async: true,
                successCallback: function (r) {
                	vm.treeDataList=r.list;
                	vm.isAdmin=r.isAdmin;
                	vm.isCompany=r.isCompany;
                    $.fn.zTree.init($("#architectureTree"), setting, r.list).expandAll(true);
                    vm.showAllEmployee=true;
                    if(r&&r.list&&r.list.length>0){
                    	for (var i = 0; i < r.list.length; i++) {
                    		if(r.list[i].parentId=='0'){
                    			vm.companyInfo=r.list[i];
                    			if(!vm.parentDepartment.id){
                    				vm.parentDepartment=r.list[i];
                    			}
                    			if(val){
                    				vm.reloadDepartmentInfo();
                    				vm.reloadEmployeeInfo();
                    				vm.reloadBranch();
                    			}else{
                    				$("#departmentInfoGrid").Grid({
                    					url: '../org/depart/list',
                    					colModel: [
            					           {label: 'id', name: 'id', index: 'id', key: true, hidden: true},
            					           {label: '部门名称', name: 'name', index: 'name', width: 80},
            					           {label: '部门描述', name: 'content', index: 'content', width: 80},
            					           {label: '创建时间', name: 'createTime', index: 'create_time', width: 80}],
            					        postData: {'companyId':vm.companyInfo.id,'parentId':vm.parentDepartment.id}
                    				});
                    				$("#employeeInfoGrid").Grid({
                    					url: '../org/employeeInfo/list',
                    					colModel: [
            					           {label: 'id', name: 'id', index: 'id', key: true, hidden: true},
            					           {label: '姓名', name: 'name', index: 'name', width: 80},
            					           {label: '手机号', name: 'phone', index: 'phone', width: 80},
            					           {label: '职位', name: 'positionName', index: 'position', width: 80},
            					           {label: '主管', name: 'director', index: 'director', width: 80,
            					        	   formatter: function (value) {
	            									var result="";
	            									switch (value) {
	            										case 0:result='<span class="label label-danger">否</span>';break;
	            										case 1:result='<span class="label label-success">是</span>';break;
	            										default:result='<span class="label label-danger">否</span>';break;
	            									}
	            									return result;
	            								}
            					           },
            					           {label: '创建时间', name: 'createTime', index: 'create_time', width: 80}],
            					         postData: {'companyId':vm.companyInfo.id,'departId':vm.parentDepartment.id}
                    				});
                    			    $("#companyBranchGrid").Grid({
                    			        url: '../org/branch/list',
                    			        colModel: [
                    						{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
                    						{label: '门店简称', name: 'name', index: 'name', width: 80},
                    						{label: '门店全名', name: 'allName', index: 'all_name', width: 80},
                    						{label: '联系人', name: 'attn', index: 'attn', width: 80},
                    						{label: '联系人电话', name: 'phone', index: 'phone', width: 80},
                    						{label: '门店电话', name: 'tel', index: 'tel', width: 80}],
                    			    	postData: {'companyId':vm.companyInfo.id,'parentId':vm.parentDepartment.id}
                    			    });
                    			}
                    			break;
                    		}
                    	}
                    }
                }
            });
		},
		queryDepartment: function () {
			vm.reloadDepartmentInfo();
		},
		queryEmployeeInfo: function () {
			vm.showAllEmployee=true;
			vm.reloadEmployeeInfo();
		},
		queryBranch: function () {
			vm.reloadBranch();
		},
		addDepartment: function () {
			vm.showDepartmentList = false;
			vm.title = "新增部门";
			vm.orgDepartment = {companyId:vm.companyInfo.id,type:1};
		},
		addEmployee: function () {
			vm.showEmployeeList = false;
			vm.title = "新增员工";
			vm.employeeInfo = {companyId:vm.companyInfo.id,roleList:[],positionPartList:[],positionName:'',position:'无',positionContent:'无',director:'0'};
			vm.getRole();
		},
		updateEmployeePassword:function(){
			var id = getSelectedRow("#employeeInfoGrid");
			if (id == null) {
				return;
			}
			var employeeData=getSelectedRowData("#employeeInfoGrid");
			vm.employeeData=employeeData;
			vm.employeeData.newPassword="888888";
			openWindow({
                title: "修改密码",
                area: ['350px', '280px'],
                content: jQuery("#employeePasswordLayer"),
                btn: ['修改', '取消'],
                btn1: function (index) {
                	layer.close(index);
                    Ajax.request({
                        url: '../org/employeeInfo/password',
                        params: JSON.stringify({'id': vm.employeeData.id, 'newPassword': vm.employeeData.newPassword}),
                        type: 'POST',
                        contentType:'application/json;chartset=UTF-8',
                        successCallback: function (result) {
                        	alert('操作成功');
                        }
                    });
                }
            });
		},
		updateDepartment: function (event) {
            var id = getSelectedRow("#departmentInfoGrid");
			if (id == null) {
				return;
			}
			vm.showDepartmentList = false;
            vm.title = "修改部门";

            vm.getDepartmentInfo(id);
		},
		updateEmployee: function (event) {
			var id = getSelectedRow("#employeeInfoGrid");
			if (id == null) {
				return;
			}
			vm.showEmployeeList = false;
			vm.title = "修改员工";
			
			vm.getRole();
			vm.getEmployeeInfo(id);
		},
		updateBranch: function (event) {
			vm.uploadLicenseList=[];
			vm.uploadIdcardPositiveList=[];
			vm.uploadIdcardReverseList=[];
			var id = getSelectedRow("#companyBranchGrid");
			if (id == null) {
				return;
			}
			vm.showBranchList = false;
			vm.title = "修改分公司";
			
			vm.getBranch(id);
			vm.getUploadFileToken();
		},
		saveOrUpdateDepartment: function (event) {
			vm.orgDepartment.parentId=vm.parentDepartment.id;
			if(vm.orgDepartment.parentId==vm.orgDepartment.id){
				alert('上级部门不可以是本级!');
				return;
			}
            var url = vm.orgDepartment.id == null ? "../org/depart/save" : "../org/depart/update";
            Ajax.request({
			    url: url,
                params: JSON.stringify(vm.orgDepartment),
                type: "POST",
			    contentType: "application/json",
                successCallback: function (r) {
                    alert('操作成功', function (index) {
                    	vm.getArchitectureTreeList(vm.companyInfo.id);
                        vm.reloadDepartmentInfo();
                    });
                }
			});
		},
		saveOrUpdateEmployee: function (event) {
			vm.employeeInfo.departId=vm.parentDepartment.id;
			if(vm.roleList.length==1&&vm.employeeInfo.roleList){
				vm.employeeInfo.roleList=[vm.roleList[0].id];
			}
			var url = vm.employeeInfo.id == null ? "../org/employeeInfo/save" : "../org/employeeInfo/update";
			Ajax.request({
				url: url,
				params: JSON.stringify(vm.employeeInfo),
				type: "POST",
				contentType: "application/json",
				successCallback: function (r) {
					alert('操作成功', function (index) {
						vm.getArchitectureTreeList(vm.companyInfo.id);
						vm.showAllEmployee=true;
						vm.reloadEmployeeInfo();
					});
				}
			});
		},
		saveOrUpdateBranch: function (event) {
			vm.orgCompanyBranch.parentId=vm.parentDepartment.id;
			if(vm.orgCompanyBranch.parentId==vm.orgCompanyBranch.id){
				alert('上级部门不可以是本级!');
				return;
			}
			var url = vm.orgCompanyBranch.id == null ? "../org/branch/save" : "../org/branch/update";
			Ajax.request({
				url: url,
				params: JSON.stringify(vm.orgCompanyBranch),
				type: "POST",
				contentType: "application/json",
				successCallback: function (r) {
					alert('操作成功', function (index) {
						vm.getArchitectureTreeList(vm.companyInfo.id);
						vm.reloadBranch();
					});
				}
			});
		},
		delDepartment: function (event) {
            var ids = getSelectedRows("#departmentInfoGrid");
			if (ids == null){
				return;
			}

			confirm('确定要删除选中的记录？', function () {
                Ajax.request({
				    url: "../org/architecture/delete",
                    params: JSON.stringify(ids),
                    type: "POST",
				    contentType: "application/json",
                    successCallback: function () {
                        alert('操作成功', function (index) {
                        	vm.getArchitectureTreeList(vm.companyInfo.id);
                            vm.reloadDepartmentInfo();
                        });
					}
				});
			});
		},
		delEmployee: function (event) {
			var ids = getSelectedRows("#employeeInfoGrid");
			if (ids == null){
				return;
			}
			
			confirm('确定要删除选中的记录？', function () {
				Ajax.request({
					url: "../org/employeeInfo/delete",
					params: JSON.stringify(ids),
					type: "POST",
					contentType: "application/json",
					successCallback: function () {
						alert('操作成功', function (index) {
							vm.getArchitectureTreeList(vm.companyInfo.id);
							vm.showAllEmployee=true;
							vm.reloadEmployeeInfo();
						});
					}
				});
			});
		},
		delBranch: function (event) {
			var ids = getSelectedRows("#companyBranchGrid");
			if (ids == null){
				return;
			}
			
			confirm('确定要删除选中的记录？', function () {
				Ajax.request({
					url: "../org/architecture/delete",
					params: JSON.stringify(ids),
					type: "POST",
					contentType: "application/json",
					successCallback: function () {
						alert('操作成功', function (index) {
							vm.reloadBranch();
						});
					}
				});
			});
		},
		getDepartmentInfo: function(id){
            Ajax.request({
                url: "../org/depart/info/"+id,
                async: true,
                successCallback: function (r) {
                    vm.orgDepartment = r.orgDepartment;
                }
            });
		},
		getEmployeeInfo: function(id){
			Ajax.request({
				url: "../org/employeeInfo/info/"+id,
				async: true,
				successCallback: function (r) {
					vm.employeeInfo = r.employee;
					if(!vm.employeeInfo.roleList){
						vm.employeeInfo.roleList=[];
					}
				}
			});
		},
		getBranch: function(id){
			Ajax.request({
				url: "../org/branch/info/"+id,
				async: true,
				successCallback: function (r) {
					vm.orgCompanyBranch = r.orgCompanyBranch;
					if(vm.orgCompanyBranch.license){
                    	vm.uploadLicenseList.push({name:vm.orgCompanyBranch.license.substr(vm.orgCompanyBranch.license.lastIndexOf("/")),url:vm.orgCompanyBranch.license,status:'finished'});
                    }
                    if(vm.orgCompanyBranch.idcardPositive){
                    	vm.uploadIdcardPositiveList.push({name:vm.orgCompanyBranch.idcardPositive.substr(vm.orgCompanyBranch.idcardPositive.lastIndexOf("/")),url:vm.orgCompanyBranch.idcardPositive,status:'finished'});
                    }
                    if(vm.orgCompanyBranch.idcardReverse){
                    	vm.uploadIdcardReverseList.push({name:vm.orgCompanyBranch.idcardReverse.substr(vm.orgCompanyBranch.idcardReverse.lastIndexOf("/")),url:vm.orgCompanyBranch.idcardReverse,status:'finished'});
                    }
				}
			});
		},
		reloadDepartmentInfo: function (event) {
			vm.showDepartmentList = true;
            var page = $("#departmentInfoGrid").jqGrid('getGridParam', 'page');
			$("#departmentInfoGrid").jqGrid('setGridParam', {
                postData: {'name': vm.departmentQuery.name,'companyId':vm.companyInfo.id,'parentId':vm.parentDepartment.id},
                page: 1
            }).trigger("reloadGrid");
            vm.handleDepartmentReset('formDepartmentValidate');
		},
		reloadEmployeeInfo: function (event) {
			var queryParams={'name': vm.employeeQuery.name,'phone':vm.employeeQuery.phone,'position':vm.employeeQuery.position,'companyId':vm.companyInfo.id,'departId':vm.parentDepartment.id};
			if(!vm.showAllEmployee){
				queryParams={'companyId':vm.companyInfo.id};
			}
			vm.showEmployeeList = true;
			var page = $("#employeeInfoGrid").jqGrid('getGridParam', 'page');
			$("#employeeInfoGrid").jqGrid('setGridParam', {
				postData: queryParams,
				page: page
			}).trigger("reloadGrid");
			vm.handleEmployeeReset('formEmployeeValidate');
		},
		reloadBranch: function (event) {
			vm.showBranchList = true;
			var page = $("#companyBranchGrid").jqGrid('getGridParam', 'page');
			$("#companyBranchGrid").jqGrid('setGridParam', {
				postData: {'name': vm.branchQuery.name,'phone':vm.branchQuery.phone,'attn':vm.branchQuery.attn,'companyId':vm.companyInfo.id,'parentId':vm.parentDepartment.id},
				page: page
			}).trigger("reloadGrid");
			vm.handleEmployeeReset('formBranchValidate');
		},
		queryEmployeeInfoAll: function () {
			vm.showAllEmployee=false;
			vm.employeeQuery = {
	    			name: '',phone:'',position:''
	        	};
	        	vm.reloadEmployeeInfo();
		},
		reloadSearchDepartmentInfo: function() {
            vm.departmentQuery = {
                name: ''
            };
            vm.reloadDepartmentInfo();
        },
        reloadSearchEmployeeInfo: function() {
        	vm.showAllEmployee=true;
        	vm.employeeQuery = {
    			name: '',phone:'',position:''
        	};
        	vm.reloadEmployeeInfo();
        },
        reloadSearchBranch: function() {
        	vm.branchQuery = {
    			name: '',phone:'',attn:''
        	};
        	vm.reloadBranch();
        },
        handleDepartmentSubmit: function (name) {
            handleSubmitValidate(this, name, function () {
                vm.saveOrUpdateDepartment()
            });
        },
        handleEmployeeSubmit: function (name) {
        	handleSubmitValidate(this, name, function () {
        		vm.saveOrUpdateEmployee()
        	});
        },
        handleSubmitBranch: function (name) {
        	handleSubmitValidate(this, name, function () {
        		vm.saveOrUpdateBranch()
        	});
        },
        handleDepartmentReset: function (name) {
            handleResetForm(this, name);
        },
        handleEmployeeReset: function (name) {
        	handleResetForm(this, name);
        },
        handleResetBranch: function (name) {
        	handleResetForm(this, name);
        },
        handleView:function(file){
        	openWindow({
            	type: 2,
                title: "图片显示",
                area: ['80%', '60%'],
                content: [file.url],
                btn: ['确定', '取消'],
                btn1: function (index,layero) {
                    layer.close(index);
                }
            });
        },
        handleRemove:function(type){
        	switch (type) {
				case "license":vm.uploadLicenseList=[];break;
				case "idcardPositive":vm.uploadIdcardPositiveList=[];break;
				case "idcardReverse":vm.uploadIdcardReverseList=[];break;
				default:break;
			}
        },
        handleSuccessLicense:function(res, file){
        	vm.uploadLicenseList.push({name:file.name,url:vm.baseImgUrl+res.key,status:'finished'});
        	vm.orgCompanyBranch.license=vm.baseImgUrl+res.key;
        },
        handleSuccessIdcardPositive:function(res, file){
        	vm.uploadIdcardPositiveList.push({name:file.name,url:vm.baseImgUrl+res.key,status:'finished'});
        	vm.orgCompanyBranch.idcardPositive=vm.baseImgUrl+res.key;
        },
        handleSuccessIdcardReverse:function(res, file){
        	vm.uploadIdcardReverseList.push({name:file.name,url:vm.baseImgUrl+res.key,status:'finished'});
        	vm.orgCompanyBranch.idcardReverse=vm.baseImgUrl+res.key;
        },
        handleImgFormatError:function(file){
        	alert('图片格式错误！支持图片格式为:jpg,png,jpeg!');
        },
        handleImgMaxSize:function(file){
        	alert('图片最大大小为4M!');
        },
        handleLicenseImgBeforeUpload:function(){
        	var check = vm.uploadLicenseList.length < 1;
            if (!check) {
            	alert('首先删除原来的图片!');
            }
            return check;
        },
        handleIdcardPositiveImgBeforeUpload:function(){
        	var check = vm.uploadIdcardPositiveList.length < 1;
        	if (!check) {
        		alert('首先删除原来的图片!');
        	}
        	return check;
        },
        handleIdcardReverseImgBeforeUpload:function(){
        	var check = vm.uploadIdcardReverseList.length < 1;
        	if (!check) {
        		alert('首先删除原来的图片!');
        	}
        	return check;
        }
	}
});